//
//  YijiaCellOne.m
//  HomeIn
//
//  Created by dllo on 15/11/9.
//  Copyright © 2015年 ZZP. All rights reserved.
//

#import "YijiaCellOne.h"
#import "YijiaModel.h"

@implementation YijiaCellOne

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}
-(void)createSubViews
{
    self.imgsrc = [[UIImageView alloc]initWithFrame:CGRectMake(5 * WIDTHSCALE, 5 * HEIGHTSCALE, 95 * WIDTHSCALE,90 * HEIGHTSCALE)];
    [self.contentView addSubview:self.imgsrc];
    
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(105 * WIDTHSCALE, 5 * HEIGHTSCALE, 250 * WIDTHSCALE, 20 * HEIGHTSCALE)];
    [self.contentView addSubview:self.titleLabel];
    
    self.digestLabel = [[UILabel alloc]initWithFrame:CGRectMake(105 * WIDTHSCALE, 25 * HEIGHTSCALE, 250 * WIDTHSCALE, 65 * HEIGHTSCALE)];
    [self.digestLabel setFont:[UIFont systemFontOfSize:14]];
    [self.digestLabel setNumberOfLines:2];
    self.digestLabel.textColor = [UIColor grayColor];
    [self.contentView addSubview:self.digestLabel];
    
    self.replyCountLabel = [[UILabel alloc]initWithFrame:CGRectMake(280 * WIDTHSCALE, 80 * HEIGHTSCALE, 80 * WIDTHSCALE, 15 * HEIGHTSCALE)];
    [self.contentView addSubview:self.replyCountLabel];
    [self.replyCountLabel setFont:[UIFont systemFontOfSize:13]];
    self.replyCountLabel.textColor = [UIColor grayColor];
    
}

-(void)setModel:(YijiaModel *)model
{
    _model = model;

    [self.imgsrc sd_setImageWithURL:[NSURL URLWithString:_model.imgsrc]];
    self.titleLabel.text=_model.title;
    self.digestLabel.text=_model.digest;
    self.replyCountLabel.text=[NSString stringWithFormat:@"%ld跟帖",_model.replyCount];
    
}


@end
